/*
This file executes the regressions discussed in section 4 and outputs the
results to LaTeX tables (for use in the paper) as well as csv files.
*/

set more off

clear all

set scheme s1mono

local reps 1000 //number of bootstrap replications used in wild bootstrap 
				//procedure

use "$data/incFinalMonthlyTehsil" //use cleaned and aggregated violence data

//label variables
label variable totCas "Casualties"
label variable incidents "Attacks"
label variable trtXnwa "treat\(\cdot\)nwa"
label variable mo "MO"
label variable peace "Peace"
label variable obamareview "Obamareview"
label variable haqqanipakistan "Haqqani"

drop if dist=="swa" //drop SWA from analysis

xtset tehsiln monyr

*********************
*Six Region Strategy*
*********************

//First we run all our main DiD regressions, using all districts except SWA.

//Regressions with incidents as dependent varaibles

//baseline specification
xtreg incidents trtXnwa $tmFE, fe cluster(tehsiln)
eststo inc6_est1
//wild bootstrap
cgmwildboot incidents trtXnwa $tehFE $tmFE, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc6_est1

//with time trends
xtreg incidents trtXnwa $tmFE $tmTrds, fe cluster(tehsiln)
eststo inc6_est2
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc6_est2

//with time trends and additional control variables
xtreg incidents trtXnwa $tmFE $tmTrds $ctrls, fe cluster(tehsiln)
eststo inc6_est3
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc6_est3

//with time trends and additional control variables
//with tehsil-specific coefficients
xtreg incidents trtXnwa $tmFE $tmTrds $ctrls2, fe cluster(tehsiln)
eststo inc6_est4
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls2, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc6_est4

//table indicators for regression specification
estadd local tmFE = "X" : inc6_est*
estadd local tehFE = "X" : inc6_est*
estadd local tiTr = "X" : inc6_est2 inc6_est3 inc6_est4
estadd local ctrls = "X" : inc6_est3 inc6_est4
estadd local hetCtrls = "X" : inc6_est4


//Outputs Table 2
esttab inc6_est1 inc6_est2 inc6_est3 inc6_est4 using "$tables/inc6.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") title(Incident Results (Six Region Strategy)\label{tab:inc6})
	
esttab inc6_est1 inc6_est2 inc6_est3 inc6_est4 using "$tables/inc6.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


//Regressions with casualites as dependent variable (same format as above)
xtreg totCas trtXnwa $tmFE, fe cluster(tehsiln)
eststo cas6_est1
cgmwildboot totCas trtXnwa $tehFE $tmFE, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas6_est1

xtreg totCas trtXnwa $tmFE $tmTrds, fe cluster(tehsiln)
eststo cas6_est2
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas6_est2

xtreg totCas trtXnwa $tmFE $tmTrds $ctrls, fe cluster(tehsiln)
eststo cas6_est3
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas6_est3

xtreg totCas trtXnwa $tmFE $tmTrds $ctrls2, fe cluster(tehsiln)
eststo cas6_est4
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls2, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas6_est4

estadd local tmFE = "X" : cas6_est*
estadd local tehFE = "X" : cas6_est*
estadd local tiTr = "X" : cas6_est2 cas6_est3 cas6_est4
estadd local ctrls = "X" : cas6_est3 cas6_est4
estadd local hetCtrls = "X" : cas6_est4


//Outputs Table 3
esttab cas6_est1 cas6_est2 cas6_est3 cas6_est4 using "$tables/cas6.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Casualty Results (Six Region Strategy)\label{tab:cas6})
	
esttab cas6_est1 cas6_est2 cas6_est3 cas6_est4 using "$tables/cas6.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


/*
We then execute the regressions for the two-region robustness check
discussed in section 4.2. The code outputs a number of tables that were
not included in the final paper, as well as Figure 6, which summarizes
the results.
*/

*********************
*Two Region - Kurram*
*********************

xtreg incidents trtXnwa $tmFE if basic==1, fe cluster(tehsiln)
eststo inc2_kur_est1
cgmwildboot incidents trtXnwa $tehFE $tmFE if basic==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_kur_est1


xtreg incidents trtXnwa $tmFE $tmTrds if basic==1, fe cluster(tehsiln)
eststo inc2_kur_est2
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds if basic==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_kur_est2


xtreg incidents trtXnwa $tmFE $tmTrds $ctrls if basic==1, fe cluster(tehsiln)
eststo inc2_kur_est3
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls if basic==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_kur_est3


xtreg incidents trtXnwa $tmFE $tmTrds $ctrls2 if basic==1, fe cluster(tehsiln)
eststo inc2_kur_est4
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls2 if basic==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_kur_est4


estadd local tmFE = "X" : inc2_kur_est*
estadd local tehFE = "X" : inc2_kur_est*
estadd local tiTr = "X" : inc2_kur_est2 inc2_kur_est3 inc2_kur_est4
estadd local ctrls = "X" : inc2_kur_est3 inc2_kur_est4
estadd local hetCtrls = "X" : inc2_kur_est4


esttab inc2_kur_est1 inc2_kur_est2 inc2_kur_est3 inc2_kur_est4 using "$tables/inc2_kur.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Incident Results (Two Region Strategy: Kurram)\label{tab:inc2kur})
	
esttab inc2_kur_est1 inc2_kur_est2 inc2_kur_est3 inc2_kur_est4 using "$tables/inc2_kur.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


xtreg totCas trtXnwa $tmFE if basic==1, fe cluster(tehsiln)
eststo cas2_kur_est1
cgmwildboot totCas trtXnwa $tehFE $tmFE if basic==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_kur_est1


xtreg totCas trtXnwa $tmFE $tmTrds if basic==1, fe cluster(tehsiln)
eststo cas2_kur_est2
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds if basic==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_kur_est2


xtreg totCas trtXnwa $tmFE $tmTrds $ctrls if basic==1, fe cluster(tehsiln)
eststo cas2_kur_est3
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls if basic==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_kur_est3


xtreg totCas trtXnwa $tmFE $tmTrds $ctrls2 if basic==1, fe cluster(tehsiln)
eststo cas2_kur_est4
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls2 if basic==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_kur_est4


estadd local tmFE = "X" : cas2_kur_est*
estadd local tehFE = "X" : cas2_kur_est*
estadd local tiTr = "X" : cas2_kur_est2 cas2_kur_est3 cas2_kur_est4
estadd local ctrls = "X" : cas2_kur_est3 cas2_kur_est4
estadd local hetCtrls = "X" : cas2_kur_est4


esttab cas2_kur_est1 cas2_kur_est2 cas2_kur_est3 cas2_kur_est4 using "$tables/cas2_kur.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Casualty Results (Two Region Strategy: Kurram)\label{tab:cas2kur})
	
esttab cas2_kur_est1 cas2_kur_est2 cas2_kur_est3 cas2_kur_est4 using "$tables/cas2_kur.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


*********************
*Two Region - Bajaur*
*********************

xtreg incidents trtXnwa $tmFE if basic2==1, fe cluster(tehsiln)
eststo inc2_baj_est1
cgmwildboot incidents trtXnwa $tehFE $tmFE if basic2==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_baj_est1


xtreg incidents trtXnwa $tmFE $tmTrds if basic2==1, fe cluster(tehsiln)
eststo inc2_baj_est2
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds if basic2==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_baj_est2


xtreg incidents trtXnwa $tmFE $tmTrds $ctrls if basic2==1, fe cluster(tehsiln)
eststo inc2_baj_est3
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls if basic2==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_baj_est3


xtreg incidents trtXnwa $tmFE $tmTrds $ctrls2 if basic2==1, fe cluster(tehsiln)
eststo inc2_baj_est4
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls2 if basic2==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_baj_est4


estadd local tmFE = "X" : inc2_baj_est*
estadd local tehFE = "X" : inc2_baj_est*
estadd local tiTr = "X" : inc2_baj_est2 inc2_baj_est3 inc2_baj_est4
estadd local ctrls = "X" : inc2_baj_est3 inc2_baj_est4
estadd local hetCtrls = "X" : inc2_baj_est4


esttab inc2_baj_est1 inc2_baj_est2 inc2_baj_est3 inc2_baj_est4 using "$tables/inc2_baj.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Incident Results (Two Region Strategy: Bajaur)\label{tab:inc2baj})
	
esttab inc2_baj_est1 inc2_baj_est2 inc2_baj_est3 inc2_baj_est4 using "$tables/inc2_baj.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


xtreg totCas trtXnwa $tmFE if basic2==1, fe cluster(tehsiln)
eststo cas2_baj_est1
cgmwildboot totCas trtXnwa $tehFE $tmFE if basic2==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_baj_est1


xtreg totCas trtXnwa $tmFE $tmTrds if basic2==1, fe cluster(tehsiln)
eststo cas2_baj_est2
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds if basic2==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_baj_est2


xtreg totCas trtXnwa $tmFE $tmTrds $ctrls if basic2==1, fe cluster(tehsiln)
eststo cas2_baj_est3
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls if basic2==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_baj_est3


xtreg totCas trtXnwa $tmFE $tmTrds $ctrls2 if basic2==1, fe cluster(tehsiln)
eststo cas2_baj_est4
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls2 if basic2==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_baj_est4


estadd local tmFE = "X" : cas2_baj_est*
estadd local tehFE = "X" : cas2_baj_est*
estadd local tiTr = "X" : cas2_baj_est2 cas2_baj_est3 cas2_baj_est4
estadd local ctrls = "X" : cas2_baj_est3 cas2_baj_est4
estadd local hetCtrls = "X" : cas2_baj_est4


esttab cas2_baj_est1 cas2_baj_est2 cas2_baj_est3 cas2_baj_est4 using "$tables/cas2_baj.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Casualty Results (Two Region Strategy: Bajaur)\label{tab:cas2baj})
	
esttab cas2_baj_est1 cas2_baj_est2 cas2_baj_est3 cas2_baj_est4 using "$tables/cas2_baj.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


*********************
*Two Region - Khyber*
*********************

xtreg incidents trtXnwa $tmFE if basic3==1, fe cluster(tehsiln)
eststo inc2_khy_est1
cgmwildboot incidents trtXnwa $tehFE $tmFE if basic3==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_khy_est1


xtreg incidents trtXnwa $tmFE $tmTrds if basic3==1, fe cluster(tehsiln)
eststo inc2_khy_est2
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds if basic3==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_khy_est2


xtreg incidents trtXnwa $tmFE $tmTrds $ctrls if basic3==1, fe cluster(tehsiln)
eststo inc2_khy_est3
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls if basic3==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_khy_est3


xtreg incidents trtXnwa $tmFE $tmTrds $ctrls2 if basic3==1, fe cluster(tehsiln)
eststo inc2_khy_est4
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls2 if basic3==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_khy_est4


estadd local tmFE = "X" : inc2_khy_est*
estadd local tehFE = "X" : inc2_khy_est*
estadd local tiTr = "X" : inc2_khy_est2 inc2_khy_est3 inc2_khy_est4
estadd local ctrls = "X" : inc2_khy_est3 inc2_khy_est4
estadd local hetCtrls = "X" : inc2_khy_est4


esttab inc2_khy_est1 inc2_khy_est2 inc2_khy_est3 inc2_khy_est4 using "$tables/inc2_khy.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Incident Results (Two Region Strategy: Khyber)\label{tab:inc2khy})
	
esttab inc2_khy_est1 inc2_khy_est2 inc2_khy_est3 inc2_khy_est4 using "$tables/inc2_khy.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


xtreg totCas trtXnwa $tmFE if basic3==1, fe cluster(tehsiln)
eststo cas2_khy_est1
cgmwildboot totCas trtXnwa $tehFE $tmFE if basic3==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_khy_est1

xtreg totCas trtXnwa $tmFE $tmTrds if basic3==1, fe cluster(tehsiln)
eststo cas2_khy_est2
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds if basic3==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_khy_est2


xtreg totCas trtXnwa $tmFE $tmTrds $ctrls if basic3==1, fe cluster(tehsiln)
eststo cas2_khy_est3
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls if basic3==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_khy_est3


xtreg totCas trtXnwa $tmFE $tmTrds $ctrls2 if basic3==1, fe cluster(tehsiln)
eststo cas2_khy_est4
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls2 if basic3==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_khy_est4


estadd local tmFE = "X" : cas2_khy_est*
estadd local tehFE = "X" : cas2_khy_est*
estadd local tiTr = "X" : cas2_khy_est2 cas2_khy_est3 cas2_khy_est4
estadd local ctrls = "X" : cas2_khy_est3 cas2_khy_est4
estadd local hetCtrls = "X" : cas2_khy_est4


esttab cas2_khy_est1 cas2_khy_est2 cas2_khy_est3 cas2_khy_est4 using "$tables/cas2_khy.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Casualty Results (Two Region Strategy: Khyber)\label{tab:cas2khy})
	
esttab cas2_khy_est1 cas2_khy_est2 cas2_khy_est3 cas2_khy_est4 using "$tables/cas2_khy.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


**********************
*Two Region - Mohmand*
**********************

xtreg incidents trtXnwa $tmFE if basic4==1, fe cluster(tehsiln)
eststo inc2_moh_est1
cgmwildboot incidents trtXnwa $tehFE $tmFE if basic4==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_moh_est1

xtreg incidents trtXnwa $tmFE $tmTrds if basic4==1, fe cluster(tehsiln)
eststo inc2_moh_est2
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds if basic4==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_moh_est2


xtreg incidents trtXnwa $tmFE $tmTrds $ctrls if basic4==1, fe cluster(tehsiln)
eststo inc2_moh_est3
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls if basic4==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_moh_est3


xtreg incidents trtXnwa $tmFE $tmTrds $ctrls2 if basic4==1, fe cluster(tehsiln)
eststo inc2_moh_est4
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls2 if basic4==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_moh_est4


estadd local tmFE = "X" : inc2_moh_est*
estadd local tehFE = "X" : inc2_moh_est*
estadd local tiTr = "X" : inc2_moh_est2 inc2_moh_est3 inc2_moh_est4
estadd local ctrls = "X" : inc2_moh_est3 inc2_moh_est4
estadd local hetCtrls = "X" : inc2_moh_est4


esttab inc2_moh_est1 inc2_moh_est2 inc2_moh_est3 inc2_moh_est4 using "$tables/inc2_moh.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Incident Results (Two Region Strategy: Mohmand)\label{tab:inc2moh})
	
esttab inc2_moh_est1 inc2_moh_est2 inc2_moh_est3 inc2_moh_est4 using "$tables/inc2_moh.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


xtreg totCas trtXnwa $tmFE if basic4==1, fe cluster(tehsiln)
eststo cas2_moh_est1
cgmwildboot totCas trtXnwa $tehFE $tmFE if basic4==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_moh_est1

xtreg totCas trtXnwa $tmFE $tmTrds if basic4==1, fe cluster(tehsiln)
eststo cas2_moh_est2
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds if basic4==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_moh_est2


xtreg totCas trtXnwa $tmFE $tmTrds $ctrls if basic4==1, fe cluster(tehsiln)
eststo cas2_moh_est3
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls if basic4==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_moh_est3


xtreg totCas trtXnwa $tmFE $tmTrds $ctrls2 if basic4==1, fe cluster(tehsiln)
eststo cas2_moh_est4
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls2 if basic4==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_moh_est4


estadd local tmFE = "X" : cas2_moh_est*
estadd local tehFE = "X" : cas2_moh_est*
estadd local tiTr = "X" : cas2_moh_est2 cas2_moh_est3 cas2_moh_est4
estadd local ctrls = "X" : cas2_moh_est3 cas2_moh_est4
estadd local hetCtrls = "X" : cas2_moh_est4


esttab cas2_moh_est1 cas2_moh_est2 cas2_moh_est3 cas2_moh_est4 using "$tables/cas2_moh.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Casualty Results (Two Region Strategy: Mohmand)\label{tab:cas2moh})
	
esttab cas2_moh_est1 cas2_moh_est2 cas2_moh_est3 cas2_moh_est4 using "$tables/cas2_moh.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


**********************
*Two Region - Orakzai*
**********************

xtreg incidents trtXnwa $tmFE if basic5==1, fe cluster(tehsiln)
eststo inc2_ora_est1
cgmwildboot incidents trtXnwa $tehFE $tmFE if basic5==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_ora_est1


xtreg incidents trtXnwa $tmFE $tmTrds if basic5==1, fe cluster(tehsiln)
eststo inc2_ora_est2
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds if basic5==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_ora_est2


xtreg incidents trtXnwa $tmFE $tmTrds $ctrls if basic5==1, fe cluster(tehsiln)
eststo inc2_ora_est3
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls if basic5==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_ora_est3


xtreg incidents trtXnwa $tmFE $tmTrds $ctrls2 if basic5==1, fe cluster(tehsiln)
eststo inc2_ora_est4
cgmwildboot incidents trtXnwa $tehFE $tmFE $tmTrds $ctrls2 if basic5==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : inc2_ora_est4


estadd local tmFE = "X" : inc2_ora_est*
estadd local tehFE = "X" : inc2_ora_est*
estadd local tiTr = "X" : inc2_ora_est2 inc2_ora_est3 inc2_ora_est4
estadd local ctrls = "X" : inc2_ora_est3 inc2_ora_est4
estadd local hetCtrls = "X" : inc2_ora_est4


esttab inc2_ora_est1 inc2_ora_est2 inc2_ora_est3 inc2_ora_est4 using "$tables/inc2_ora.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Incident Results (Two Region Strategy: Orakzai)\label{tab:inc2ora})
	
esttab inc2_ora_est1 inc2_ora_est2 inc2_ora_est3 inc2_ora_est4 using "$tables/inc2_ora.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


xtreg totCas trtXnwa $tmFE if basic5==1, fe cluster(tehsiln)
eststo cas2_ora_est1
cgmwildboot totCas trtXnwa $tehFE $tmFE if basic5==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_ora_est1

xtreg totCas trtXnwa $tmFE $tmTrds if basic5==1, fe cluster(tehsiln)
eststo cas2_ora_est2
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds if basic5==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_ora_est2


xtreg totCas trtXnwa $tmFE $tmTrds $ctrls if basic5==1, fe cluster(tehsiln)
eststo cas2_ora_est3
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls if basic5==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_ora_est3


xtreg totCas trtXnwa $tmFE $tmTrds $ctrls2 if basic5==1, fe cluster(tehsiln)
eststo cas2_ora_est4
cgmwildboot totCas trtXnwa $tehFE $tmFE $tmTrds $ctrls2 if basic5==1, cluster(tehsiln) bootcluster(tehsiln) reps(`reps')
scalar p = e(pval)
estadd scalar wcbp = p : cas2_ora_est4


estadd local tmFE = "X" : cas2_ora_est*
estadd local tehFE = "X" : cas2_ora_est*
estadd local tiTr = "X" : cas2_ora_est2 cas2_ora_est3 cas2_ora_est4
estadd local ctrls = "X" : cas2_ora_est3 cas2_ora_est4
estadd local hetCtrls = "X" : cas2_ora_est4


esttab cas2_ora_est1 cas2_ora_est2 cas2_ora_est3 cas2_ora_est4 using "$tables/cas2_ora.tex", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls") ///
	title(Casualty Results (Two Region Strategy: Orakzai)\label{tab:cas2ora})
	
esttab cas2_ora_est1 cas2_ora_est2 cas2_ora_est3 cas2_ora_est4 using "$tables/cas2_ora.csv", replace label se star(* 0.05) keep(trtXnwa  mo peace obamareview haqqanipakistan) scalar("wcbp WB p-value" "tmFE Year FE" "tehFE Tehsil FE" "tiTr Time Trends" "ctrls Controls" "hetCtrls Hetero. Ctrls")


******************
*Two Region - All*
******************

//Compile two-region results into plots presents in Figure 6
coefplot  (inc6_est1, label("Base Spec.")) (inc6_est2, label("Time Trends")) (inc6_est3, label("Time Trends and Controls")) (inc6_est4, label("Time Trends and Hetero. Controls")), bylabel("Six Region" "Strategy") || (inc2_kur_est1, label("Base Spec.")) (inc2_kur_est2, label("Time Trends")) (inc2_kur_est3, label("Time Trends and Controls")) (inc2_kur_est4, label("Time Trends and Hetero. Controls")), bylabel("Kurram" "Control")|| (inc2_baj_est1, label("Base Spec.")) (inc2_baj_est2, label("Time Trends")) (inc2_baj_est3, label("Time Trends and Controls")) (inc2_baj_est4, label("Time Trends and Hetero. Controls")), bylabel("Bajaur" "Control") || (inc2_khy_est1, label("Base Spec.")) (inc2_khy_est2, label("Time Trends")) (inc2_khy_est3, label("Time Trends and Controls")) (inc2_khy_est4, label("Time Trends and Hetero. Controls")), bylabel("Khyber" "Control") || (inc2_moh_est1, label("Base Spec.")) (inc2_moh_est2, label("Time Trends")) (inc2_moh_est3, label("Time Trends and Controls")) (inc2_moh_est4, label("Time Trends and Hetero. Controls")), bylabel("Mohmand" "Control") || (inc2_ora_est1, label("Base Spec.")) (inc2_ora_est2, label("Time Trends")) (inc2_ora_est3, label("Time Trends and Controls")) (inc2_ora_est4, label("Time Trends and Hetero. Controls")), bylabel("Orakzai" "Control") legend(off) keep(trtXnwa) vertical bycoefs yline(0) ylabel(,angle(0) labsize(large)) ytitle("") xlabel(,labsize(medlarge))
graph export "$figures/incResAll.pdf", replace
coefplot (cas6_est1, label("Base Spec.")) (cas6_est2, label("Time Trends")) (cas6_est3, label("Time Trends and Controls")) (cas6_est4, label("Time Trends and Hetero. Controls")), bylabel("Six Region" "Strategy") || (cas2_kur_est1, label("Base Spec.")) (cas2_kur_est2, label("Time Trends")) (cas2_kur_est3, label("Time Trends and Controls")) (cas2_kur_est4, label("Time Trends and Hetero. Controls")), bylabel("Kurram" "Control")|| (cas2_baj_est1, label("Base Spec.")) (cas2_baj_est2, label("Time Trends")) (cas2_baj_est3, label("Time Trends and Controls")) (cas2_baj_est4, label("Time Trends and Hetero. Controls")), bylabel("Bajaur" "Control") || (cas2_khy_est1, label("Base Spec.")) (cas2_khy_est2, label("Time Trends")) (cas2_khy_est3, label("Time Trends and Controls")) (cas2_khy_est4, label("Time Trends and Hetero. Controls")), bylabel("Khyber" "Control") || (cas2_moh_est1, label("Base Spec.")) (cas2_moh_est2, label("casl. Time Trends")) (cas2_moh_est3, label("Time Trends and Controls")) (cas2_moh_est4, label("Time Trends and Hetero. Controls")), bylabel("Mohmand" "Control") || (cas2_ora_est1, label("Base Spec.")) (cas2_ora_est2, label("Time Trends")) (cas2_ora_est3, label("Time Trends and Controls")) (cas2_ora_est4, label("Time Trends and Hetero. Controls")), bylabel("Orakzai" "Control") legend(rows(4) ring(0) pos(5) size(medlarge)) keep(trtXnwa) vertical bycoefs yline(0) ylabel(,angle(0) labsize(large)) ytitle("") xlabel(,labsize(medlarge))
graph export "$figures/casResAll.pdf", replace
